package alex.game.network
{
	import alex.game.updatable.plane.BasicPlane;
	
	import com.framework.GG;
	import com.framework.util.Log;
	
	import flash.geom.Point;

	public class Converger
	{
		public var plane:BasicPlane;
		
		public var posX:Number;
		public var posY:Number;
		public var rot:Number;
		public var acceleration:Number;
		
		private var isConverging:Boolean = false;
		
		public function Converger(plane:BasicPlane,posX:Number, posY:Number, rot:Number = 0,acceleration:Number = 1)
		{
			this.plane = plane;
			this.posX = posX;
			this.posY = posY;
			this.rot = rot;
			this.acceleration = acceleration;
		}
		public function run():void
		{
			//Step par step pour connaitre la position de l'avion
			plane.rotation = plane.rotation + rot;
			if(!isConverging)
			{
				this.posX = Math.cos(plane.rotation * Math.PI/180) * ((GG.elapsedTime/100)*plane.speed)+posX;
				this.posY = Math.sin(plane.rotation * Math.PI/180) * ((GG.elapsedTime/100)*plane.speed)+posY;
			}
		}
	}
}